import CryptoJS from "crypto-js";

const secretKey = "7fPq1vIdS/jxYVX5uK9MEkEINYYpsYcb6+Lf17xZT48=";

export function encryptPassword(password) {
  const key = CryptoJS.enc.Base64.parse(secretKey);
  const iv = CryptoJS.lib.WordArray.create([0, 0, 0, 0]); // 全零

  const encrypted = CryptoJS.AES.encrypt(password, key, {
    iv: iv,
    mode: CryptoJS.mode.CBC,
    padding: CryptoJS.pad.Pkcs7
  });

  return encrypted.toString();
}
